#pragma once

#include <atlcrack.h>

class CKtvOnlineDlg  :  public CDialogImpl<CKtvOnlineDlg>
{
public:
	CKtvOnlineDlg(void);
	~CKtvOnlineDlg(void);

	CListViewCtrl m_wndList1;

	enum { IDD = IDD_DLG_KTV_ONLINE };

	BEGIN_MSG_MAP(CKtvOnlineDlg)
		MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
		COMMAND_ID_HANDLER(IDOK, OnCloseCmd)
		COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd)
		MSG_WM_ERASEBKGND(OnEraseBkgnd)
		MSG_WM_SIZE(OnSize)

		NOTIFY_HANDLER(IDC_LIST_ONLINE, NM_CUSTOMDRAW, OnNMCustomdrawListOnline)
	END_MSG_MAP()

	LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
	LRESULT OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);

	LRESULT OnEraseBkgnd(HDC hdc);
	LRESULT OnSize(UINT state, CSize Size);

	int InitOnlineCtrl(void);

	CBrush m_brLeft;
	CBrush m_brRight;

	CBitmap m_bmBrush1;
	CBitmap m_bmBrush2;

	CPen   penHighLight;
	CPen   penOutline;

	map<int, wstring> m_mapServerAddr;
	map<int, DWORD> m_mapProgress;

	CListViewCtrl* GetKtvOnlineCtrl(void);

	LRESULT OnNMCustomdrawListOnline(int /*idCtrl*/, LPNMHDR pNMHDR, BOOL& /*bHandled*/);
	
	int SetServerAddress(int nIndex, wstring strServerAddr);
	int SetPlayProgress(int nIndex, DWORD dwProgress);
};
